<template>
  <body>
  <div class="background">
    <img src="static/background.jpg" width="100%" height="100%" alt="" />
  </div>
  <el-page-header @back="goBack" content="个人信息" style="margin-top: -2%">
  </el-page-header>
  <div>
    <el-card class="card">
      <H2>用户信息</H2>
      <router-link :to="{path:'/editInfo',query:{user:this.user}}" style="width:20px;margin-left: 80%;">
        <el-link icon="el-icon-edit" style="font-size: 18px">编辑信息</el-link>
      </router-link>
      <el-form>
        <el-form-item style="margin-top: 5%">
          <el-tag style="width: 100%;height: 100%;font-size: 20px;background: hsla(0, 0%, 80%, .25) border-box;"><div style="color: black;text-align: center">用户名: {{user.customerId}}</div></el-tag>
        </el-form-item>
        <el-form-item>
          <el-tag style="width: 100%;height: 100%;font-size: 20px;background: hsla(0, 0%, 80%, .25) border-box;"><div style="color: black;text-align: center">姓名: {{user.userName}}</div></el-tag>
        </el-form-item>
        <el-form-item>
          <el-tag style="width: 100%;height: 100%;font-size: 20px;background: hsla(0, 0%, 80%, .25) border-box;"><div style="color: black;text-align: center">电话号码: {{user.phoneNumber}}</div></el-tag>
        </el-form-item>
        <el-form-item>
          <el-tag style="width: 100%;height: 100%;font-size: 20px;background: hsla(0, 0%, 80%, .25) border-box;"><div style="color: black;text-align: center">地址: {{user.address}}</div></el-tag>
        </el-form-item>
        <el-form-item>
          <el-tag style="width: 100%;height: 100%;font-size: 20px;background: hsla(0, 0%, 80%, .25) border-box;"><div style="color: black;text-align: center ">余额: {{user.balance}}元</div></el-tag>
        </el-form-item>
        <el-form-item style="margin-bottom: 60px">
          <router-link to="recharge">
          <el-button
            style="width: 40%;background: darkslateblue;font-size: 18px"
            type="primary">充值</el-button>
          </router-link>
          <router-link to="changePw">
            <el-button
              type="primary"
              style="width: 40%;background: darkslateblue;border: none;font-size: 18px">修改密码</el-button>
          </router-link>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
  </body>
</template>

<script>
  export default {
    data() {
      return {
        user:{
          customerId: '',
          passWord: '',
          userName: '',
          phoneNumber: '',
          address: '',
          balance: '',
          power:''
      }
      };
    },
    created(){

      this.$axios.post('/user/selectBI/'+this.$store.state.customerId)
        .then(resp => {
          if (resp.data.code == 200) {
            this.user = resp.data.data;
          }
        });
    },
    methods: {
      goBack(){
        this.$router.go(-1);
      },
    }
  };
</script>

<style scoped>
  .background{
    width:100%;
    height:100%;
    left: 0%;
    top: 0%;
    z-index: -1;
    position: fixed;
  }
  .card{
    position: relative;
    margin-top: 6%;
    margin-left: 37%;
    padding: 1em;
    max-width: 23em;
    background: hsla(0,0%,50%,.25) border-box;
    box-shadow: 0 0 0 1px hsla(0,0%,100%,.3) inset,
    0 .5em 1em rgba(0, 0, 0, 0.6);
    text-shadow: 0 1px 1px hsla(0,0%,100%,.3);
  }
  .line{
    width: 20px;
    margin-top: 0%;
    margin-left: 25%;
  }
  .line1{
    width: 250px;
    height: 20px;
    font-size: 20px;
    margin-top: -11%;
    margin-left: 40%;
    text-align: left;
    outline: black;
  }
</style>
